<template>
    <div>
        文章标题：<input
            type="text"
            v-model="title" />
        <br />
        是否公开:<input
            type="checkbox"
            v-model="isOpen" />
        <br />
        文章内容：<textarea v-model="content"></textarea><br />
        <el-button
            type="primary"
            @click="publish"
            >Primary</el-button
        >
    </div>
</template>

<script setup lang="ts">
    import http from '../utils/http'
    import { ref } from 'vue'
    let title = ref('')
    let isOpen = ref(false)
    let content = ref('')
    function publish() {
        http({
            method: 'post',
            url: '/posts',
            data: {
                title: title.value,
                content: content.value,
                status: isOpen.value,
            },
        }).then((res: any) => {
            console.log(res)
        })
    }
</script>

<style></style>
